<!DOCTYPE html>
<html>

<head>
    <title>我的资料</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/myProfiles.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script>
        $(function () {
            //获取当前登录的用户
            var user = JSON.parse(sessionStorage.getItem("user"));
            //获取粉丝与关注的数量
            $.get("/users/"+user.id,function (data) {
                $('.info').renderValues(data);
            })
            //渲染页面
            $('.info').renderValues(user);


            //点击粉丝或关注跳转
            $(".follow").click(function () {
                window.location.href="/mine/friends.html";
            })
            $(".fans").click(function () {
                window.location.href="/mine/friends.html?state=true";
            })



            //渲染签到页面
            $.get('/signs', function (data) {
                $('.ssInfo').renderValues(data);
                console.log(data);
            })

            //签到功能 : ajax发送签到请求
            $('#signInfo').click(function () {
                $.post('/signs', function (data) {
                    //根据判断弹窗
                    if(data.success==true){
                        var toast5 = $(document).dialog({
                            type : 'toast',
                            infoIcon: 'http://pgf7k79ux.bkt.clouddn.com/835746b36e3be7f5.png',
                            infoText: '正在签到中',
                        });
                        setTimeout(function () {
                            toast5.update({
                                infoIcon: 'http://pgf7k79ux.bkt.clouddn.com/835746b36e3be7f4.png',
                                infoText: '签到成功',
                                autoClose: 700,
                            });
                        }, 700);

                        //累计续签为3的倍数,积分翻倍
                        if (data.result.count % 3 ==0){ // 因为点击完之后就是3了
                            setTimeout(function () {
                                toast5.update({
                                    infoIcon: 'http://pgf7k79ux.bkt.clouddn.com/cba0ad8332238d95b78.png',
                                    infoText: '恭喜获得额外10积分',
                                    autoClose: 700,
                                });
                            }, 700);
                        }
                    }else{
                        $(document).dialog({
                            titleShow: false,
                            content: data.msg,
                        });
                    }


                   //

                    //渲染页面
                    $('.ssInfo').renderValues(data);
                    console.log(data);

                })
            })


            //商城页面跳转
            $('#shopInfo').click(function () {
              location.href='/signStore.html';
            })
        });
    </script>
    <style type="text/css">
        .level{
            color: #ff9d00;
        }
    </style>
</head>

<body>
<div class="nav-search">
    <a href="/index.html">
        <span><i class="fa fa-angle-left fa-2x"></i></span>
    </a>
</div>
<hr/>
<div class="container">
    <div class="row info">
        <div class="col-2" style="margin-right: 25px;">
            <img class="rounded-circle" render-src="headImgUrl">
        </div>
        <div class="col-8">
            <h5 render-html="nickName"></h5>
            <ul class="list-inline">
                <li class="list-inline-item">
                    <small>常住地</small>
                </li>
                <li class="list-inline-item">
                    <small render-html="place"></small>
                </li>
                <li class="list-inline-item follow">
                    <small >关注<span render-html="fans" class="level"></span></small>
                </li>
                <li class="list-inline-item fans">
                    <small>粉丝<span render-html="follows"  class="level"></span></small>
                </li>
            </ul>
        </div>
    </div>

    <div class="d-flex setting">
        <div class="p-2 flex-fill">
            <a href="editTravels.html">
                <button class="btn">
                    <i class="fa fa-camera fa-fw"></i>
                    记录我的旅游日记
                </button>
            </a>
        </div>
        <div class="p-2 flex-fill">
            <a href="info.html">
                <button class="btn">编辑个人资料</button>
            </a></div>
    </div>

</div>

<hr />

<div class="row link-box ssInfo">
	<div class="col" id="shopInfo">
		<ul class="list-inline" >
			<li class="list-inline-item"> <i class="fa fa-shopping-bag fa-2x"></i> </li>
			<li class="list-inline-item">
				<h7>积分商城</h7>
				<small>我的积分 <span render-html="result.signScore"></span></small>
            </li>
		</ul>
	</div>
	<div class="col" id="signInfo">
		<ul class="list-inline">
			<li class="list-inline-item"> <i class="fa fa-calendar-check-o fa-2x"></i> </li>
			<li class="list-inline-item">
				<h7>每日签到</h7>
				</li>
		</ul>
	</div>
</div>
<hr/>
<ul class="mainmenu">
    <li><a href="/mine/myCollection.html"><b><i class="fa fa-star fa-2x"></i></b><span>我的收藏</span></a></li>
    <li><a href="/mine/friendColumn.html"><b><i class="fa fa-2x"><img width="40%" src="/js/plugins/bootstrap-4.1.1-dist/css/pig.jpg"/></i></b><span>猪友动态</span></a></li>
    <li><a href="#"><b><i class="fa fa-commenting-o fa-2x"></i></b><span>我的评论</span></a></li>
    <li><a href="/mine/travels.html"><b><i class="fa fa-book fa-2x"></i></b><span>我的游记</span></a></li>
    <li><a href="#"><b><i class="fa fa-list-ul fa-2x"></i></b><span>我的心愿单</span></a></li>
    <li><a href="#"><b><i class="fa fa-bullhorn fa-2x"></i></b><span>我的消息</span></a></li>
    <li><a href="/mine/myOrders.html"><b><i class="fa fa-file-text fa-2x"></i></b><span>我的订单</span></a></li>
    <li><a href="/mine/myWallet.html"><b><i class="fa fa-briefcase fa-2x"></i></b><span>我的钱包</span></a></li>
</ul>

</body>

</html>